import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Login from '@/pages/login/login'
import Register from '@/pages/register/register'
import Home from '@/pages/home/home'
import Phone from '@/pages/home/children/phone'
import Books from '@/pages/home/children/books'
import Fresh from '@/pages/home/children/fresh'
import Clothes from '@/pages/home/children/clothes'


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path:'/login',
      name:'Login',
      component:Login,
      props:(route) =>({id:route.query.id,name:route.query.name})
    },
    {
      path:'/register',
      name:'Register',
      component:Register,
      props:(route) =>({id:route.query.id,name:route.query.name})
    },
    {
      path:'/home',
      name:'Home',
      component:Home,
      children:[
        {
          path:'phone',
          component:Phone
        },
        {
          path:'books',
          component:Books
        },
        {
          path:'fresh',
          component:Fresh
        },
        {
          path:'clothes',
          component:Clothes
        }
      ]
    }
  ]
})
